<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="spring" 	uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="tiles" 	uri="http://tiles.apache.org/tags-tiles" %>
<%@ taglib prefix="c"		uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page language="java" pageEncoding="utf-8"%>

<script type="text/javascript">
$(document).ready(function(){
	setMenuSelection("clienti");
	
    $("#btParteneriList").kendoButton({icon: "funnel"});

    $("#btParteneriCard").kendoButton({icon: "plus"});
	
    $("#btApplyFilter").kendoButton({icon: "tick"});

    $("#btResetFilter").kendoButton({icon: "cancel"});
    
    
    $("#gridParteneriList").kendoGrid({
    	dataSource : {
            type     : "json",
            transport: {
                read: "json/listRegPartners"
            },
            schema   : {
                data: ""
            }
        },
        columns: [
				{
					field:"id",  							
					title: "#",
					width: 40,
					hidden: true
				},
          		{	
					field:"idno",  						
					title: "Cod fiscal",
					sortable: true,
					width: 100 , 
					template: renderIdnp
				},
                {field: "companyName", 					title: "Denumire firmă", 					width: 100},
                {field: "address", 						title: "Adresa", 				width: 120},
                {field: "phoneMob", 					title: "Telefon mobil", 				width: 90},
                {field: "emal", 						title: "E-mail", 				width: 120},
                {field: "skype", 						title: "Skype", 				width: 120},
                {field: "bossNameSurname", 				title: "Director", 				width: 120},
                {	
					field:"id",  						
					title: "Achitari",
					sortable: true,
					width: 50 , 
					template: renderPayments
				},
          ],
          height: 500,
          sortable: true,
          pageable: {
        	  pageSize: 10,
        	  pageSizes: [10,15,20],
        	  refresh: true
          }

    });    
 
function  renderIdnp (dataItem, b, c) {
	return "<a href='adaugaParteneri?pId="+dataItem.id + "'>" + kendo.htmlEncode(dataItem.idno) + "</a>"; 
	}    
	
function  renderPayments (dataItem, b, c) {
	return "<a href='adaugaAchitari?pPartenerId="+dataItem.id + "'>Achitari</a>"; 
};

});

function btApplyClick(){
	$("#gridParteneriList").data("kendoGrid").dataSource.read();
	$("#gridParteneriList").data("kendoGrid").refresh();
}

function btResetClick(){
	
}
		
</script>
<CENTER>
<p style="text-align: left;">
	<button id="btParteneriList" type="button" onclick="javascript:window.open('vizualizeazaParteneri', target='_self')";>Lista partenerilor</button>
	<button id="btParteneriCard" type="button" onclick="javascript:window.open('adaugaParteneri', 		target='_self')";>Adaugă partener</button>
	<c:if test="${errorMessage != '' &&  errorMessage != '0'}">
		<span id="errorMessage" class="errorMessage"> ${errorMessage} </span>
	</c:if>
	
</p>
<div id="gridParteneriList"></div>

</center>




